package com.vincent.rocketmqdemo.controller;

import com.vincent.rocketmqdemo.entity.User;
import com.vincent.rocketmqdemo.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserMapper userMapper;


    @RequestMapping("/list")
    public List<User> listUser() {
        List<User> userList = userMapper.selectAll();
        return userList;
    }

    @RequestMapping("/{id}")
    public User getById(@PathVariable Integer id) {
        return userMapper.getByUserId(id);
    }


}
